<?php 
namespace Admin\Controller;
use HDPHP\Library\Controller;
/**
 * 后台默认控制器
 */
class IndexController extends AuthController{
	/**
	 * 默认方法
	 */
	public function index(){
		//获得周几**
		$arr = array(
			'Monday' => '一',
			'Friday' => '五',
		);
		$date = getdate();
//		echo $arr[$date['weekday']];
		
		$this->display();
	}
	//欢迎界面
	public function welcome(){
	    $this->display();
	}
	//用户列表 
	public function user_list(){
		//查询所有用户数据
		$usersql="SELECT * FROM hd_user";
		$userData=M()->query($usersql);
		$this->assign('userData', $userData);
//		z($userData);
	    $this->display();
	}
	//所有的问题
	public function ask(){
		$asksql="SELECT * FROM hd_ask";
		$askData=M()->query($asksql);
//		z($askData);
		$this->assign('askData', $askData);
		
		
		$this->display();
	}
	//待解决问题
	public function ask1(){
		$asksql="SELECT * FROM hd_ask WHERE solve=0";
		$askData=M()->query($asksql);
//		z($askData);
		$this->assign('askData', $askData);
		$this->display();
	}
	//已解决问题
	public function ask2(){
		$asksql="SELECT * FROM hd_ask WHERE solve=1";
		$askData=M()->query($asksql);
//		z($askData);
		$this->assign('askData', $askData);
		
		$this->display();
	}
	//无回答问题
	public function ask3(){
		$asksql="SELECT * FROM hd_ask WHERE answer=0";
		$askData=M()->query($asksql);
//		z($askData);
		$this->assign('askData', $askData);
		$this->display();
	}
	//所有的回答
	public function answer(){
		$asksql="SELECT * FROM hd_answer";
		$askData=M()->query($asksql);
//		z($askData);
		$this->assign('askData', $askData);
		$this->display();
	}
	
	//未采纳回答
	public function answer1(){
		$asksql="SELECT * FROM hd_answer WHERE accept=0";
		$askData=M()->query($asksql);
//		z($askData);
		$this->assign('askData', $askData);
		$this->display();
	}
	//已采纳回答
	public function answer2(){
		$asksql="SELECT * FROM hd_answer WHERE accept=1";
		$askData=M()->query($asksql);
//		z($askData);
		$this->assign('askData', $askData);
		$this->display();
	}
	
	
		//退出方法
	public function out(){		
		session_unset();
		session_destroy();
		$this->success('退出成功','index.php?m=admin&c=Login');
	}
}






